package cn.itsource.org.domain;

import cn.itsource.basic.domain.BaseDomain;
import cn.itsource.basic.domain.BaseTreeNode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

/**
 * 下拉多写:滚珠下拉
 * 格式化:ctrl+alt+L
 * 光标最前后移动 Home End
 *
 * 驼峰命名
 */
@Table(name="t_department") //表名
@Data //生成get set hashcode equals
@AllArgsConstructor //全参构造
@NoArgsConstructor //无参构造
@ApiModel(value = "部门对象", description = "部门对象参数")
public class Department extends BaseTreeNode<Department> {

    //编号
    @ApiModelProperty(value = "部门编号")
    @Size(min = 3,max = 8,message = "部门编号必须在3-8位之间")
    private String sn;
    //名称
    @ApiModelProperty(value = "部门名称")
    @NotBlank(message = "部门名称不能为空")
    private String name;
    //状态 1:启用 0:禁用
    private Integer state;
    //部门经理id
    @Column(name="manager_id")
    private Long managerId;
    //父部门
    @Column(name="parent_id")
    private Long parentId;
    //先不管
    @Column(name="dir_path")
    private String dirPath;

    /**
     * 临时字段
     * 配置这个注解,这个字段不参与表的curd了
     */
/*
    @Transient
    private String managerName;
    @Transient
    private String parentName;

*/
    @Transient
    private Employee manager;

    @Transient
    private Department parent;

    @Transient
    private Long[] parentIds;

}
